package com.zjj.day0425.date;

import java.time.LocalDate;
import java.time.temporal.ChronoUnit;
import java.util.Calendar;

/**
 * @author zhoujunjie
 * @desc TODO
 * @date 2025/4/25
 */
public class Date {
    public static void main(String[] args) {
        LocalDate startDate1 = LocalDate.of(2012, 12, 28);
        LocalDate endDate1 = LocalDate.of(2014, 5, 25);
        long daysBetween1 = ChronoUnit.DAYS.between(startDate1, endDate1);
        System.out.println("\"2014-5-25\"到\"2012-12-28\"中间有 " + daysBetween1 + " 天。");

        Calendar c = Calendar.getInstance();
        c.add(Calendar.DAY_OF_MONTH, 500);
        int y = c.get(Calendar.YEAR);
        int M = c.get(Calendar.MONTH) + 1;
        int d = c.get(Calendar.DAY_OF_MONTH);
        int wk = c.get(Calendar.DAY_OF_WEEK)-1;
        int H = c.get(Calendar.HOUR_OF_DAY);
        int m = c.get(Calendar.MINUTE);
        int s = c.get(Calendar.SECOND);

        System.out.println("距离当前时间500天后的日期是 " + y +"年"+M+"月"+d+"日" + "，时间是 " + H+":"+m+":"+s + "，星期是周" + wk);

        LocalDate date = LocalDate.of(2003, 4, 5);
        System.out.println("2003年4月5日是 " + date.getDayOfWeek());
    }
}
